using System;
using System.Collections.Generic;
using System.Text;
using DCI6.Client.API;

namespace DCIAPIRMSampleCode {
    internal class ReceivingDataSampleCode {
        public DCIMessageListener ConstructCallBackListener() {
            /**
             * Construct an instance of an Object that
             * implements DCIMessageListener
             */
            Console.WriteLine("Constructing a new DCIMessageListener");
            DCIReceiver cb = new DCIReceiver();
            return cb;
        }

        public void SetCallBackListener(DCIMessageListener dciCallbackReceiver) {
            /**
             * Calling the static method setSubscriptionListener
             * on the DCIClient class will register your callback
             * handler and all callback data will be passed to the
             * appropriate method on the particular Instance 
             * of DCIMessageListener which is supplied as a parameter.
             */
            Console.WriteLine("Calling DCIClient.setSubscriptionListener");
            DCIClient.setSubscriptionListener(dciCallbackReceiver);
        }

        public void StopCallBackListener() {
            /**
             * Calling the static method StopSubscriptionListener
             * on the DCIClient class will remove all Instances of 
             * DCIMessageListener currently configured by calling
             * setSubscriptionListener.
             */
            Console.WriteLine("Calling DCIClient.stopSubscriptionListener");
            DCIClient.stopSubscriptionListener();
        }
    }
}